#!/usr/bin/python
# -*- coding: UTF-8 -*-

import smtplib
from email.mime.text import MIMEText
from email.header import Header

mail_host="smtp.163.com"
mail_user="songhao1991710@163.com"
mail_pass="xxxxxx"

sender = 'songhao1991710@163.com'
receivers = ['425008064@qq.com']

body_content = """ 项目文本 """
message = MIMEText(body_content, 'plain', 'utf-8')

message['From'] = "haizeiwang<songhao1991710@163.com>"
message['To'] = "haizeiwang<425008064@qq.com>"

subject = """ 项目异常测试邮件 """
message['Subject'] = Header(subject, 'utf-8')
smtpObj = smtplib.SMTP()
smtpObj.connect(mail_host, 25)
smtpObj.set_debuglevel(1)

smtpObj.login(mail_user,mail_pass)
smtpObj.sendmail(sender, receivers, message.as_string())
print("邮件发送成功")
smtpObj.quit()